const responseBody = {
	message: '',
	timestamp: 0,
	result: true,
	data: null
}
/**
 * @param {Object} data 返回的数据类容
 * @param {Object} message 提示信息
 * @param {Object} result 状态
 * @param {Object} headers 头部
 */
export const builder = (data, message, result = true, headers = {}) => {
	responseBody.data = data
	if (message !== undefined && message !== null) {
		responseBody.message = message
	}
	if (result) {
		responseBody.result = result
	}
	if (headers !== null && typeof headers === 'object' && Object.keys(headers).length > 0) {
		responseBody._headers = headers
	}
	responseBody.timestamp = new Date().getTime()
	return responseBody
}
/**
 * 获取传参
 */
export const getBody = (options) => {
	return options.body && JSON.parse(options.body)
}
